/* Copyright (c) 2004-2024 Peigen.info. All rights reserved. */

package info.peigen.hotpot.business.customer.core.service.processor.idempotent;

import cn.hutool.core.lang.Assert;
import info.peigen.hotpot.business.customer.core.service.processor.base.AbstractCustomerServiceProcessor;
import info.peigen.hotpot.business.customer.facade.order.update.CustomerUpdateOrder;
import info.peigen.hotpot.common.service.base.processor.Processor;
import info.peigen.hotpot.common.service.base.processor.ProcessorServiceContext;
import org.noear.solon.annotation.Component;

/**
 * <b>(WxMiniappMobileProcessor)</b>
 *
 * @author czj
 * @version 1.0.0
 * @since 2022/8/10
 */
@SuppressWarnings("rawtypes")
@Component
public class WxMiniappMobileIdempotentProcessor extends AbstractCustomerServiceProcessor implements Processor {

    @Override
    public Integer level() {
        return 10;
    }

    @Override
    public void execute(ProcessorServiceContext serviceContext) {
        CustomerUpdateOrder order = (CustomerUpdateOrder) serviceContext.getOrder();
        Assert.isNull(customerRepository.activeByLoginName(order.getMobile()), "该手机号已存在");
    }


}
